// code_module.h: Carries information about code modules that are loaded
// into a process.
//

#ifndef LONGKEY_BREAKPAD_PROCESSOR_CODE_MODULE_H_
#define LONGKEY_BREAKPAD_PROCESSOR_CODE_MODULE_H_

#include <string>

namespace longkey_breakpad
{
	using std::string;

	class CodeModule
	{
	public:
		virtual ~CodeModule() {}

		// The base address of this code module as it was loaded by the process.
		// (u_int64_t)-1 on error.
		virtual u_int64_t base_address() const = 0;

		// The size of the code module.  0 on error.
		virtual u_int64_t size() const = 0;

		// The path or file name that the code module was loaded from.  Empty on
		// error.
		virtual string code_file() const = 0;

		// An identifying string used to discriminate between multiple versions and
		// builds of the same code module.  This may contain a uuid, timestamp,
		// version number, or any combination of this or other information, in an
		// implementation-defined format.  Empty on error.
		virtual string code_identifier() const = 0;

		// The filename containing debugging information associated with the code
		// module.  If debugging information is stored in a file separate from the
		// code module itself (as is the case when .pdb or .dSYM files are used),
		// this will be different from code_file.  If debugging information is
		// stored in the code module itself (possibly prior to stripping), this
		// will be the same as code_file.  Empty on error.
		virtual string debug_file() const = 0;

		// An identifying string similar to code_identifier, but identifies a
		// specific version and build of the associated debug file.  This may be
		// the same as code_identifier when the debug_file and code_file are
		// identical or when the same identifier is used to identify distinct
		// debug and code files.
		virtual string debug_identifier() const = 0;

		// A human-readable representation of the code module's version.  Empty on
		// error.
		virtual string version() const = 0;

		// Creates a new copy of this CodeModule object, which the caller takes
		// ownership of.  The new CodeModule may be of a different concrete class
		// than the CodeModule being copied, but will behave identically to the
		// copied CodeModule as far as the CodeModule interface is concerned.
		virtual const CodeModule* Copy() const = 0;
	};
}

#endif	// LONGKEY_BREAKPAD_PROCESSOR_CODE_MODULE_H_